/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package poker_sim;

import java.awt.Component;
import javax.swing.JPanel;

/**
 *
 * @author Rob
 */
public class CardCollection extends Component{
    private JPanel TextPanel = null;
    public Card[] card;
    int Size = 0;
    int Location = 0;
    CardViewer View = null;
    public CardCollection(int _size, CardViewer _view)
    {
        View = _view;
        Size = _size;
        card = new Card[_size];
    }
    public void AddCard(Card _card)
    {
        card[Location] = _card;
        View.LoadCard(_card.IMG);
        
        if(TextPanel != null)
        {
            ((HandRankViewer)TextPanel).AddCardText(_card.Getfullname());
        }
        Location++;
        
    }
    
    public void LoadPanel(Component Comp)
    {
        TextPanel = (JPanel)Comp;
    }
    
    public void Reset()
    {
        if(TextPanel != null)
        {
            ((HandRankViewer)TextPanel).Reset();
        }
        card = new Card[Size];
        Location = 0;
        View.Reset();
    }
    
}
